pow.webserver
Class UserTab

java.lang.Object
  extended by pow.webserver.UserTab
All Implemented Interfaces:
java.io.Serializable

public class UserTab
extends java.lang.Object
implements java.io.Serializable

User objects are stored in a UserTab object which can be serialized in a file on the server disk

Author:
genin
See Also:
User, Serialized Form

Constructor Summary
UserTab()
          create a empty list of users
 
Method Summary
 boolean checkUser(java.lang.String log, java.lang.String pwd)
          Check if the password of the user having the specified login is correct
 java.util.Iterator<java.lang.String> getItrUsr(java.lang.String log)
          return the list of all drone which may be controlled by the user
 java.util.Iterator<java.lang.String> getLoginIterator()
           
 void insert(User u)
          insert a user in the list
 boolean isInside(java.lang.String log)
          check if an user with this logging exists yet
 void remove(java.lang.String log)
          remove the user with the spefied login
 User seek(java.lang.String log)
          return the user corresponding to the given login
 void serialize(java.lang.String nomfichier)
          Save the object in a file
static UserTab unserialize(java.lang.String nomfichier)
          load the object from a file
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserTab

public UserTab()
create a empty list of users

Method Detail

insert

public void insert(User u)
            throws AlreadyRegisteredUserException
insert a user in the list

Parameters:
u - a user object to insert
Throws:
AlreadyRegisteredUserException

remove

public void remove(java.lang.String log)
remove the user with the spefied login

Parameters:
log - the login of the user to remove

seek

public User seek(java.lang.String log)
return the user corresponding to the given login

Parameters:
log - the login of the user to seek
Returns:
the user object corresponding to the login or null if it is not present

isInside

public boolean isInside(java.lang.String log)
check if an user with this logging exists yet

Parameters:
log - the login of the user to check
Returns:
true if the user having the login exists

checkUser

public boolean checkUser(java.lang.String log,
                         java.lang.String pwd)
Check if the password of the user having the specified login is correct

Parameters:
log - the login of the user
pwd - the password
Returns:
true if there is a user with this login and this password

getItrUsr

public java.util.Iterator<java.lang.String> getItrUsr(java.lang.String log)
return the list of all drone which may be controlled by the user

Parameters:
log - the login of the user
Returns:
an iterator containing the list of drone or null is the user does not exist

getLoginIterator

public java.util.Iterator<java.lang.String> getLoginIterator()
Returns:
an iterator on all login in the list

serialize

public void serialize(java.lang.String nomfichier)
Save the object in a file

Parameters:
nomfichier - the file where the user's accounts will be stored

unserialize

public static UserTab unserialize(java.lang.String nomfichier)
load the object from a file

Parameters:
nomfichier - the file where the user's accounts are stored
Returns:
an object containing the users list or null if the pathname is not correct